		
		var flg = true;		
		var addTask = document.getElementById('addTask');		
		var box3 = document.getElementById('box3');			
		var body = document.getElementsByTagName('body')[0];
		var selecttime = document.getElementById('selecttime');
		var settimeinput = document.getElementById('settimeinput');
		
		
		
		body.onclick = function(){			
			if(flg){ 
				selecttime.style.display = 'inline';
				settimeinput.style.display = 'none';
				box3.style.display = 'none';
				
			}	
			flg = true;		
		};		
		addTask.onclick = function(){	
			flg = false;
			selecttime.style.display = 'inline';
			settimeinput.style.display = 'none';
			box3.style.display = 'block';		
		};	
		box3.onclick = function(){
			flg = false;
		};
		$("#addNewTask").click(function(){
			var taskname  = $("#taskname").val();
			var selecttime = $("#selecttime").val();
			var settimeinput= $("#settimeinput").val();
			var taskType="person";
			var leibie= $("#leibie").val();
			if(settimeinput.length!=0){
				$.post("http://localhost:80/crm/task/addTask.action",{taskname:taskname,settimeinput:settimeinput,leibie:leibie,taskType:taskType},function(data){
				});
				$(".box").hide();
				$("#tishi").show();
				$("#tishi").fadeOut(3500); 
				  /*$.ajax({
				        type:"post",
				        cache:false,
				        url:"http://localhost:80/crm/task/addTask.action",
				        data: ({taskname:taskname,settimeinput:settimeinput,leibie:leibie,taskType:taskType}),
				        dataType:"json",
				        beforeSend:function(){
				           $("#loading").append('<img src="http://localhost:80/crm/img/dots-white.gif"/>');
				        },
				        success:function(data){
				          // $("#city").html(data.info);//添加下拉框的option
				        },
				        complete: function() {
				        	$("#loading").remove();
				        }
				 
				     });*/
			}else{
				
				$.post("http://localhost:80/crm/task/addTask.action",{taskname:taskname,selecttime:selecttime,leibie:leibie,taskType:taskType},function(data){
					
				});
				$(".box").hide();
				$("#tishi").show();
				$("#tishi").fadeOut(3500); 
				
			}
			
			
			
			
		});
		
		
		